package crawler;

public class STCPipe extends Pipe {
	

	public STCPipe() {
		super();
	}

	
	public synchronized void sendPendindgWebs(NVQueue<String> _pendingWebs) {
		if (!_pendingWebs.isEmpty()) {
			pendingWebs = _pendingWebs;
		
			while (full) {
				try {
					wait();
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
	
			full = true;
			request = false;
			notify();
		}

	}
	
	public synchronized NVQueue<String> receivePendingWebs() {
		
		//System.out.println(full);
		while (!full || request) {
			try {
				wait();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		full = false;
		request = true;
		notify();
		return pendingWebs;
	}
	
	

}
